<!-- 首页 -->
<template>
  <div class="home">
    <!-- 顶部显示 -->
    <van-sticky>
      <div class="topbar">
        <div class="topfix">
          <img class="toimg" src="@/assets/home/logo.jpg" alt="" />
        </div>
        <div class="topfr" @click="show = true">
          <span>分享APP</span>
        </div>
      </div>
    </van-sticky>
    <!-- 选项卡功能组件 -->
    <van-tabs v-model="active" title-active-color="#ee0a24" sticky offset-top="84">
      <!-- 推荐音乐显示内容区 -->
      <van-tab title="推荐音乐">
        <div class="m-homeremd">
          <h2 class="remd_tl">编辑推荐</h2>
          <div class="remd_songs">
            <div class="remd_ul">
              <CardView></CardView>
            </div>
          </div>
          <h2 class="remd_tl">最新音乐</h2>
          <div class="remd_newsg">
            <MusicList></MusicList>
          </div>
          <footer class="m-homeft">
            <div class="ftwrap">
              <div class="logo">
                <div><img src="@/assets/home/topbar.png" alt="" /></div>
              </div>
              <p class="copyright">网易公司版权所有©1997-{{ new Date().getFullYear() }} 杭州乐读科技有限公司运营</p>
            </div>
          </footer>
        </div>
      </van-tab>
      <!-- 热歌榜显示内容区 -->
      <van-tab title="热歌榜">
        <div class="hotop">
          <div class="hotopct">
            <div class="u-hmsprt hoticon"></div>
            <div class="hottime">更新日期:{{ data }}</div>
          </div>
        </div>
        <HitSongList :isHit="true"></HitSongList>
      </van-tab>
      <!-- 搜索选项卡内容区 -->
      <van-tab title="搜索">
        <SearchView></SearchView>
      </van-tab>
    </van-tabs>

    <!-- 分享弹窗 -->
    <van-dialog v-model="show" theme="round-button">
      <img src="http://qiniu.orange1205.top/note/wyy.png" width="100%" />
    </van-dialog>
  </div>
</template>

<script>
import { currentDate } from '@/utils/common'
import CardView from '@/components/CardView.vue'
import MusicList from '@/components/MusicList.vue'
import HitSongList from '@/components/HitSongList.vue'
import SearchView from '@/components/SearchView.vue'
export default {
  components: { CardView, MusicList, HitSongList, SearchView },
  name: 'Home',
  data() {
    return {
      active: '推荐音乐',//首次展示激活的选项卡
      show: false,//二维码展示
      data: currentDate(),//当前日期
    }
  },
  methods: {},
}
</script>

<style scoped lang="scss">
.home {
  .topbar {
    height: 84px;
    background-color: #d43c33;
    .topfix {
      position: relative;
      width: 142px;
      height: 25px;
      .toimg {
        position: absolute;
        left: 10px;
        top: 29.5px;
        width: 142px;
        height: 25px;
      }
    }
    .topfr {
      width: 100px;
      height: 36px;
      background-color: #fff;
      position: absolute;
      top: 24px;
      right: 10px;
      border-radius: 18px;
      text-align: center;
      > span {
        line-height: 36px;
        color: #d33a31;
      }
    }
  }
}
.m-homeremd {
  padding-top: 20px;
  border-top: 1px solid #ccc;
  background-color: #fcfcfd;
  .remd_tl {
    position: relative;
    padding-left: 9px;
    margin-bottom: 14px;
    font-size: 17px;
    height: 20px;
    line-height: 20px;
    margin-top: 0;
    font-weight: 400;
    &:after {
      content: ' ';
      position: absolute;
      left: 0;
      top: 50%;
      margin-top: -9px;
      width: 2px;
      height: 16px;
      background-color: #d33a31;
    }
  }
  .remd_songs {
    position: relative;
    padding-bottom: 24px;
    .remd_ul {
      display: flex;
      flex-wrap: wrap;
    }
  }
  .remd_newsg {
    position: relative;
    min-height: 20px;
  }
  .m-homeft {
    position: relative;
    padding-top: 53.3%;
    margin-top: 24px;
    background: url('../assets/home/recommand_bg_2x.png') no-repeat;
    background-size: contain;
    .ftwrap {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      top: 0;
      z-index: 1;
      text-align: center;
      .logo {
        padding-top: 16.9%;
        > div {
          height: 44px;
          width: 212px;
          margin: auto;
          overflow: hidden;
          border-radius: 22px;
          img {
            position: relative;
            top: -61px;
          }
        }
      }
      .copyright {
        color: #888;
        font-size: 12px;
        line-height: 16px;
        transform: scale(0.75);
        margin: 10px 0 0;
      }
    }
  }
}
.hotop {
  position: relative;
  padding-top: 38.9%;
  overflow: hidden;
  background: url('../assets/img/hot_music_bg.jpg') no-repeat;
  background-size: contain;
  &:after {
    content: ' ';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.2);
  }
  .hotopct {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 2;
    padding-left: 20px;
    box-sizing: border-box;
    .hottime {
      margin-top: 10px;
      color: hsla(0, 0%, 100%, 0.8);
      font-size: 12px;
      transform: scale(0.91);
      transform-origin: left top;
    }
  }
  .hoticon {
    width: 142px;
    height: 67px;
    background-position: -24px -30px !important;
  }
  .u-hmsprt {
    background: url('../assets/home/sq-bofang.png') no-repeat;
    background-size: 166px 97px;
  }
}
</style>

